package com.idp.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ServerProperty {

    private static final Logger logger = LoggerFactory.getLogger(ServerProperty.class);
    private static final Properties server_properties;
    private static final Properties keyConfig_properties;

    static {
        server_properties = new Properties();
        keyConfig_properties = new Properties();
        try (
                InputStream in1 = ServerProperty.class.getClassLoader().getResourceAsStream("iam/server.properties");
                InputStream in2 = ServerProperty.class.getClassLoader().getResourceAsStream("templates/properties/keyConfig.properties");
        ) {
            server_properties.load(in1);
            keyConfig_properties.load(in2);
        } catch (IOException e) {
            logger.error("fail to load server.xml", e);
        }
    }

    public static Properties getServerInstance() {
        return server_properties;
    }
    public static Properties getKeyConfigInstance() {
        return keyConfig_properties;
    }

    private ServerProperty() {

    }
}
